package com.hengxinguotong.zhihuichengjian.weekpicker.entity;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Week {
    private static final String PATTERN1 = "yyyy-MM-dd";
    private static final String PATTERN2 = "yyyy/MM/dd";
    private static final String PATTERN3 = "MM.dd";

    private int weekNum;
    private Date weekBegin;
    private Date weekEnd;

    /**
     * 获取周开始日期 (yyyy-MM-dd)
     * @return String
     */
    public String getWeekBeginDate1() {
        String date;
        SimpleDateFormat sdf = new SimpleDateFormat(PATTERN1);
        date = sdf.format(weekBegin);
        return date;
    }

    /**
     * 获取周开始日期 (yyyy/MM/dd)
     * @return String
     */
    public String getWeekBeginDate2() {
        String date;
        SimpleDateFormat sdf = new SimpleDateFormat(PATTERN2);
        date = sdf.format(weekBegin);
        return date;
    }

    /**
     * 获取周开始日期 (yyyy.MM)
     * @return String
     */
    public String getWeekBeginDate3() {
        String date;
        SimpleDateFormat sdf = new SimpleDateFormat(PATTERN3);
        date = sdf.format(weekBegin);
        return date;
    }

    /**
     * 获取周结束日期 (yyyy-MM-dd)
     * @return String
     */
    public String getWeekEndDate1() {
        String date;
        SimpleDateFormat sdf = new SimpleDateFormat(PATTERN1);
        date = sdf.format(weekEnd);
        return date;
    }

    /**
     * 获取周结束日期 (yyyy/MM/dd)
     * @return String
     */
    public String getWeekEndDate2() {
        String date;
        SimpleDateFormat sdf = new SimpleDateFormat(PATTERN2);
        date = sdf.format(weekEnd);
        return date;
    }

    /**
     * 获取周结束日期 (yyyy.MM)
     * @return String
     */
    public String getWeekEndDate3() {
        String date;
        SimpleDateFormat sdf = new SimpleDateFormat(PATTERN3);
        date = sdf.format(weekEnd);
        return date;
    }

    /**
     * 获取周下标（汉字）
     * @return String
     */
    public String getWeekNumStr() {
        String weekNumStr = "一";
        switch (weekNum){
            case 1:
                weekNumStr =  "一";
                break;
            case 2:
                weekNumStr =  "二";
                break;
            case 3:
                weekNumStr =  "三";
                break;
            case 4:
                weekNumStr =  "四";
                break;
            case 5:
                weekNumStr =  "五";
                break;
            case 6:
                weekNumStr =  "六";
                break;
        }
        return weekNumStr;
    }

    public int getWeekNum() {
        return weekNum;
    }

    public void setWeekNum(int weekNum) {
        this.weekNum = weekNum;
    }

    public Date getWeekBegin() {
        return weekBegin;
    }

    public void setWeekBegin(Date weekBegin) {
        this.weekBegin = weekBegin;
    }

    public Date getWeekEnd() {
        return weekEnd;
    }

    public void setWeekEnd(Date weekEnd) {
        this.weekEnd = weekEnd;
    }

    @Override
    public String toString() {
        return "第" + getWeekNumStr() + "周(" + getWeekBeginDate3() + " - " + getWeekEndDate3() + ")";
    }

    public String getSelectWeekBeginAndEnd() {
        return getWeekBeginDate2() + " - " + getWeekEndDate2();
    }

}